<style>
    #sku-table td {
        padding: 8px;
    }

    .sku-item {
        line-height: initial;
    }

    .sku-item span {
        font-weight: bold;
    }

    .sku-img {
        display: flex;
    }

    .sku-img .left {
        width: 50px;
    }

    .sku-img .right {
        flex: 1;
    }

    .sku-img .left img {
        cursor: pointer;
        width: 40px;
    }
</style>
<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="安装单" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="search-bar wrapper-none col-xs-12">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="客户名称" ng-model="condition.customerName">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix">
                        <label class="control-label">工单号：</label>
                        <input type="text" class="form-control" ng-model="condition.orderCode">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">客户手机号：</label>
                        <input type="text" class="form-control" ng-model="condition.customerMobi">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">代理商：</label>
                        <input type="text" class="form-control" ng-model="condition.dealerOrgNameLike">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">服务站：</label>
                        <input type="text" class="form-control" ng-model="condition.fwzNameLike">
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label">安装单状态：</label>
                        <select class="form-control" ng-model="condition.installationStatus">
                            <option value="">请选择</option>
                            <option value='0'>待安装</option>
                            <option value='1'>已安装</option>
                        </select>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                has-check-col="true" set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allCheckedBill"
                                            yb-click="selectAll(dataList, 'Bill')"></div>
                                    </th>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth"
                                            fixed-width="tbStyle.billFixedWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}"
                                        ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked"
                                            yb-click="selectSingle(item, dataList, 'Bill')"></div>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="font-0" ng-if="itemCol.type === 'operate'">
                                            <button type="button" class="btn btn-operate"
                                                ng-click="handleFinish(item)"
                                                ng-disabled="item.installationStatus==1">报完工</button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <span
                                            ng-if="!itemCol.clickFn || (itemCol.type == 'synCrm' && item[itemCol.dataField] !== '同步失败')">{{item[itemCol.dataField]}}</span>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="(!!itemCol.clickFn && itemCol.type == 'synCrm' && item[itemCol.dataField] == '同步失败')">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="itemCol.type != 'attach' && !!itemCol.clickFn && itemCol.type !== 'synCrm'">
                                            {{item[itemCol.dataField]}}
                                        </a>
                                        <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)"
                                            ng-if="itemCol.type == 'attach' && !!item[itemCol.dataField]">
                                            点击下载
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-check-box class="m-t-xs m-r-sm" yb-checked="markInfo.allCheckedBill" yb-check-name="全选"
                    yb-click="selectAll(dataList, 'Bill')"></div>
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="商城订单信息" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="m-t-sm form-up-tb clearfix">
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">客户名称：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.customerName || '-'}}">
                        {{orderObj.customerName || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">客户手机号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.moboliePhone || '-'}}">
                        {{orderObj.moboliePhone || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">订单号：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.saleCode || '-'}}">
                        {{orderObj.saleCode || "-"}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">下单时间：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.createdTime|YbDate:'yyyy-MM-dd HH:mm:ss') || '-'}}">
                        {{(orderObj.createdTime|YbDate:"yyyy-MM-dd HH:mm:ss") || '-'}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">付款时间：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.payTime|YbDate:'yyyy-MM-dd HH:mm:ss') || '-'}}">
                        {{(orderObj.payTime|YbDate:"yyyy-MM-dd HH:mm:ss") || '-'}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">发货时间：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.deliveryTime|YbDate:'yyyy-MM-dd HH:mm:ss') || '-'}}">
                        {{(orderObj.deliveryTime|YbDate:"yyyy-MM-dd HH:mm:ss") || '-'}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">完成时间：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.finishedTime|YbDate:'yyyy-MM-dd HH:mm:ss') || '-'}}">
                        {{(orderObj.finishedTime|YbDate:"yyyy-MM-dd HH:mm:ss") || '-'}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">是否需要安装：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{(orderObj.needInstall|TrueOrFalse) || '-'}}">
                        {{(orderObj.needInstall|TrueOrFalse) || '-'}}
                    </div>
                </div>
                <div class="form-group col-xs-3 m-b-sm">
                    <label class="col-xs-4 m-b-n text-right max-w-100">安装地点：</label>
                    <div class="col-xs-8 wrapper-none spill-dots" title="{{orderObj.stationAddress || '-'}}">
                        {{orderObj.stationAddress || "-"}}
                    </div>
                </div>
            </div>

            <div tabset type="sub-tab">
                <div tab heading="商品信息" active="subTabFlag[0]">
                    <div class="main-area d-b-60" ng-style="{'top':'170px'}">
                        <div yb-table-fixed class="table-fixed-wrap">
                            <div class="th-scroll-x">
                                <table class="table-fixed border-none" width="{{viewMaterielTableConfig.scrollWidth}}">
                                    <thead>
                                        <tr>
                                            <th ng-repeat="itemCol in viewMaterielTableConfig.tableCol track by $index"
                                                width="{{itemCol.width}}">
                                                <div yb-thead-operate ng-model="itemCol"
                                                    target-width="editMaterielConfig.scrollWidth"></div>
                                            </th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                            <div class="td-scroll" ng-show="orderObj.materialsList.length > 0" id="sku-table">
                                <table class="table-fixed border-none" width="{{viewMaterielTableConfig.scrollWidth}}">
                                    <tbody>
                                        <tr ng-repeat="item in orderObj.materialsList track by $index">
                                            <td ng-repeat="itemCol in viewMaterielTableConfig.tableCol | filter:{isMerge: false} track by $index" width="{{itemCol.width}}">
                                                <div ng-switch="itemCol.dataField">
                                                    <div ng-switch-when="productInfo">
                                                        <div class="sku-img">
                                                            <div class="left" ng-if="!!item.imageUrl">
                                                                <img ng-src="{{item.productInfo.imageUrlShow}}" ng-click="viewImage(item.productInfo.imageUrlShow)" />
                                                            </div>
                                                            <div class="right">
                                                                <div class="sku-item">{{item.productInfo.goodsName}}</div>
                                                                <div class="sku-item m-t-xs">{{item.productInfo.skuCode}}</div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div ng-switch-default>
                                                        <span>{{item[itemCol.dataField]}}</span>
                                                    </div>
                                                </div>
                                            </td>
                                            <td ng-repeat="itemCol in viewMaterielTableConfig.tableCol | filter:{isMerge: true} track by $index" 
                                                width="{{itemCol.width}}" rowspan="{{orderObj.materialsList.length}}" ng-if="$parent.$index==0">
                                                <div ng-switch="itemCol.dataField">
                                                    <div ng-switch-when="customerInfo">
                                                        <div class="sku-item">
                                                            <span>客户：</span>
                                                            {{item.customerInfo.customerName}}
                                                        </div>
                                                        <div class="sku-item">
                                                            <span>电话：</span>
                                                            {{item.customerInfo.moboliePhone}}
                                                        </div>
                                                    </div>
                                                    <div ng-switch-when="orderAddressInfo">
                                                        <div class="sku-item">
                                                            <span>收货人：</span>
                                                            {{item.orderAddressInfo.cname}}
                                                        </div>
                                                        <div class="sku-item">
                                                            <span>电话：</span>
                                                            {{item.orderAddressInfo.phone}}
                                                        </div>
                                                        <div class="sku-item">
                                                            <span>收货地：</span>
                                                            {{item.orderAddressInfo.address}}
                                                        </div>
                                                    </div>
                                                    <div ng-switch-when="installInfo">
                                                        <div class="sku-item">
                                                            <span>联系人：</span>
                                                            {{item.installInfo.stationContact}}
                                                        </div>
                                                        <div class="sku-item">
                                                            <span>电话：</span>
                                                            {{item.installInfo.stationContactTel}}
                                                        </div>
                                                        <div class="sku-item">
                                                            <span>地址：</span>
                                                            {{item.installInfo.stationAddress}}
                                                        </div>
                                                    </div>
                                                    <div ng-switch-default>
                                                        <span>{{item[itemCol.dataField]}}</span>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div class="no-data w-full text-center p-t" ng-show="orderObj.materialsList.length === 0">暂时没有数据</div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="bottom-area btn-bar text-center clearfix">
                <button type="button" class="btn btn-default" ng-click="cancel()">返回</button>
            </div>
        </div>
    </div>
</div>
